<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\admin\model;

use think\Model;
use app\admin\model\CommonModel;

class HomeModel extends CommonModel
{
    const PRE_RESULT    = ['主胜', '平', '客胜'];
    const GAINS         = ['红', '黑', '走水'];
    const BAT_IN_STATUS = [0, 1, 2];//对战进行中
    protected $pk = 'id';//主键，可以用get查询


    public function getThumbnailAttr($value)
    {
        return config('verify.host') . $value;
    }

    public function getVideoAttr($value)
    {
        return config('verify.host') . $value;
    }

    public function batMatch()
    {
        return $this->belongsTo('BatMatchModel', 'bat_id');;
    }

    public function batMatchTime()
    {
        return $this->belongsTo('BatMatchModel', 'bat_id')->field('match_time');;
    }

    //推荐竞猜
    public function guess()
    {
        return $this->belongsTo('BatMatchModel', 'bat_id_guess');
    }

}